package cn.crm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.crm.Service.ICustomerService;
import cn.crm.common.ServerResponse;
import cn.crm.entity.Customer;

@Controller
@RequestMapping(value="customer")
public class CustomerController {

	@Autowired
	private ICustomerService customerservice;
	
	@RequestMapping(value="tocustomerpage")
	public String tocustomerpage() {
		return "customer/customer_list";
	};
	
	@RequestMapping(value="pageList")
	@ResponseBody
	public ServerResponse pageList(Integer page,Integer limit,Customer customer){
		return customerservice.pageList(page,limit,customer);
	}
	
	@RequestMapping(value="toinsertpage")
	public String toinsertpage(){
		return "customer/customer_insert";
	}
	
	@RequestMapping(value="insert")
	@ResponseBody
	public ServerResponse insert(Customer customer){
		return customerservice.insert(customer);
	}
	
	@RequestMapping(value="selectIds")
	@ResponseBody
	public ServerResponse selectIds(){
		return customerservice.selectIds();
	}
	
}
